home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10184 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: plato.ansa.co.uk!news
  2. From: tms@ansa.co.uk (Toby Speight)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How to read in binary file?
  5. Date: 6 Mar 1996 14:23:09 GMT
  6. Organization: ANSA, Cambridge, England.
  7. Sender: tms@socrates.ansa.co.uk
  8. Message-ID: <s8ohqauwxa.fsf@socrates.ansa.co.uk>
  9. References: <4lCptna00iV5Q5qSZK@andrew.cmu.edu> <4hjdng$elu@sam.inforamp.net>
  10. NNTP-Posting-Host: socrates.ansa.co.uk
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset=US-ASCII
  13. Content-Transfer-Encoding: 7bit
  14. In-reply-to: rmorin@inforamp.net's message of Wed, 06 Mar 96 07:09:44 GMT
  15. X-Phone: +44 1223 568925
  16. X-Fax: +44 1223 359779
  17. X-Yow: Wait..  is this a FUN THING or the END of LIFE in Petticoat Junction??
  18. X-Newsreader: Gnus v5.1
  19.  
  20. -----BEGIN PGP SIGNED MESSAGE-----
  21.  
  22. >>>>> In article <4lCptna00iV5Q5qSZK@andrew.cmu.edu>,
  23. >>>>> "Sang Hyun Park, Shawn" <sangp+@andrew.cmu.edu> wrote:
  24.  
  25. >> void main(void)
  26. >> {
  27. >> short buf[2000];    // arbitrary size for trial
  28. >> ifstream ins("filename.bin");
  29. >> ins.get(buf, 2000);   *
  30. >> }
  31.  
  32. >>>>> In article <4hjdng$elu@sam.inforamp.net>,
  33. >>>>> Randy == "Randy Charles Morin" <rmorin@inforamp.net> writes:
  34.  
  35. Randy> You should make the following change...
  36. Randy>     ins.get((char *)buf, sizeof(short)*2000);
  37.  
  38. Why not
  39.  
  40. ins.get( (char*)buf, sizeof buf);
  41.  
  42.  
  43. -----BEGIN PGP SIGNATURE-----
  44. Version: 2.6.2i
  45. Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface
  46.  
  47. iQB1AwUBMT2ezOdsuUurvcRtAQHxjwMAqNdiSU3/pG4DKcmtzZFD8ywNKPazor3R
  48. IPKxkhBw8TXdSi2b7RSqny2Xu+IYXsiK374g1DlAPIngnFlTcJ+MUiopKMXKCCFW
  49. o3IASGIOx7Zawkv0SYg3tlsKqxuBpE+V
  50. =2Nb+
  51. -----END PGP SIGNATURE-----
  52. -- 
  53. Toby Speight <tms@ansa.co.uk>    Phone +44 1223 568925, Fax +44 1223 359779
  54. APM Ltd., Poseidon House, Castle Park, Cambridge CB3 0RD
  55.